package edu.spex.yjl.week09.work02;

import java.util.*;
import java.util.ArrayList;
import java.util.List;

//在Test里建立main方法，在main方法里
//构造一个主人对象tom，tom养了2条猫，4条狗。请分别给这些动物起名字，定义他们喜欢吃的食物。
public class Test {
    public static void main(String[] args){
        List sounds = new ArrayList();
        sounds.add("瞄");
        sounds.add("敖");
        List foods = new ArrayList();
        foods.add(new Food("鱼", 10));
        foods.add(new Food("米饭", 3));

        IPet dog1 = new Dog("dog1",sounds,foods);
        IPet dog2 = new Dog("dog2",sounds,foods);
        List pets = new ArrayList();
        pets.add(dog1);
        pets.add(dog2);
        Mater Tom = new Mater(pets);
        for(int i =0 ;i < Tom.getPets().size();i ++){
            IPet pet=(IPet) Tom.getPets().get(i);
            Tom.feed(pet);
        }
    }
}
